package org.liux.android.game.jumpgame.character;

public class BulgeRight extends Shape {
	
	public static final int STATE_1 = 0;
	public static final int STATE_2 = 2;
	public static final int STATE_3 = 3;
	public static final int STATE_4 = 4;
	
	@Override
	public void change(Coordinate c) {
		int x = c.x;
		int y = c.y;
		
		if (mShapeList.size() > 0) {
			mShapeList.clear();
		}
		
		if(mState == STATE_1){
			mShapeList.add(new Coordinate(x+1, y+1));
			mShapeList.add(new Coordinate(x, y+1));
			mShapeList.add(new Coordinate(x, y+2));
			mShapeList.add(new Coordinate(x-1, y+1));
			mOldState = mState;
			mState=STATE_2;
			return;
		}
		
		if(mState == STATE_2){
			mShapeList.add(new Coordinate(x-1, y+1));
			mShapeList.add(new Coordinate(x-1, y));
			mShapeList.add(new Coordinate(x-2, y));
			mShapeList.add(new Coordinate(x-1, y-1));
			mOldState = mState;
			mState=STATE_3;
			return;
		}
		
		if(mState == STATE_3){
			mShapeList.add(new Coordinate(x-1, y-1));
			mShapeList.add(new Coordinate(x, y-1));
			mShapeList.add(new Coordinate(x, y-2));
			mShapeList.add(new Coordinate(x+1, y-1));
			mOldState = mState;
			mState=STATE_4;
			return;
		}
		
		if(mState == STATE_4){
			mShapeList.add(new Coordinate(x+1, y-1));
			mShapeList.add(new Coordinate(x+1, y));
			mShapeList.add(new Coordinate(x+2, y));
			mShapeList.add(new Coordinate(x+1, y+1));
			mOldState = mState;
			mState=STATE_1;
			return;
		}

	}

	@Override
	public void initCoord() {
		mShapeList.add(new Coordinate(mMidWidth-1,0));
		mShapeList.add(new Coordinate(mMidWidth-1,1));
		mShapeList.add(new Coordinate(mMidWidth,1));
		mShapeList.add(new Coordinate(mMidWidth-1,2));

	}

}
